import java.sql.*;

public class demo1 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        // 1 导入jar包
        // 2 注册驱动
        Class.forName("com.mysql.jdbc.Driver");

        // 3 获取连接
        Connection connection = DriverManager.getConnection("mysql:jdbc://localhost:3306?homework");
        // 4 构造sql
        String sql = "";
        // 5 获取执行对象
        Statement statement = connection.createStatement();
        // 6 执行sql
        ResultSet set = statement.executeQuery(sql);
        // 7 处理结果
        // 8 释放资源
        set.close();
        statement.cancel();
        connection.close();
    }
}
